#!/bin/sh


echo $# "arguments"

if [ $# -lt 3 ]
then
echo "pas assez d'arguments"
exit
fi

host_arbitre=$1
port_arbitre=$2
nom_joueur=$3
nom_ia="localhost"
port_ia="6742"
if [ $# -eq 4 ]
then
port_ia=$4
fi

classpath="/applis/sicstus-3.11.2/lib/sicstus-3.11.2/bin/jasper.jar"
javaclass="./Java/class"
clientpath="./C/bin"

if [ "$USER" = "sofy" ]
then
classpath="/opt/sicstus/lib/sicstus-4.2.3/bin/jasper.jar"
elif [ "$USER" = "alex" ]
then
classpath="/usr/local/sicstus4.2.3/lib/sicstus-4.2.3/bin/jasper.jar"
fi

java -classpath $classpath:$javaclass InterfaceJava $port_ia &

sleep 3
./$clientpath/client $host_arbitre $port_arbitre $nom_ia $port_ia $nom_joueur &

